package my.interceptor;


import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import my.model.Category;
import my.service.CategoryService;

import java.util.List;

/**
 * Created by Administrator on 2017/6/10.
 */
public class CategoryMenuInterceptor implements Interceptor {
    @Override
    public void intercept(Invocation invocation) {
        CategoryService categoryService = new CategoryService();
        List<Category> categories = categoryService.getAllCategories();
        invocation.getController().setAttr("categories", categories);
        invocation.invoke();
    }
}
